package com.example.wechat.model;

import android.os.Parcel;
import android.os.Parcelable;

public class Contact implements Parcelable {
    private Long id;
    private String name;
    private String avatarUrl;
    private int status;
    private String wechatId;
    private int avatarResId;
    private String remark;

    public Contact(String id, String name, String avatarUrl) {
        this.id = Long.parseLong(id);
        this.name = name;
        this.avatarUrl = avatarUrl;
        this.status = 0;
        this.wechatId = "";
        this.avatarResId = 0;
        this.remark = "";
    }

    public Contact(Long id, String name, String avatarUrl, String wechatId) {
        this.id = id;
        this.name = name;
        this.avatarUrl = avatarUrl;
        this.status = 0;
        this.wechatId = wechatId;
        this.avatarResId = 0;
        this.remark = "";
    }

    public Contact(Long id, String name, String avatarUrl, int status, String wechatId) {
        this.id = id;
        this.name = name;
        this.avatarUrl = avatarUrl;
        this.status = status;
        this.wechatId = wechatId;
        this.avatarResId = 0;
        this.remark = "";
    }

    public Contact(Long id, String name, String avatarUrl, int status, String wechatId, int avatarResId, String remark) {
        this.id = id;
        this.name = name;
        this.avatarUrl = avatarUrl;
        this.status = status;
        this.wechatId = wechatId;
        this.avatarResId = avatarResId;
        this.remark = remark;
    }

    protected Contact(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        name = in.readString();
        avatarUrl = in.readString();
        status = in.readInt();
        wechatId = in.readString();
        avatarResId = in.readInt();
        remark = in.readString();
    }

    public static final Creator<Contact> CREATOR = new Creator<Contact>() {
        @Override
        public Contact createFromParcel(Parcel in) {
            return new Contact(in);
        }

        @Override
        public Contact[] newArray(int size) {
            return new Contact[size];
        }
    };

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getWechatId() {
        return wechatId;
    }

    public void setWechatId(String wechatId) {
        this.wechatId = wechatId;
    }

    public int getAvatarResId() {
        return avatarResId;
    }

    public void setAvatarResId(int avatarResId) {
        this.avatarResId = avatarResId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(id);
        }
        dest.writeString(name);
        dest.writeString(avatarUrl);
        dest.writeInt(status);
        dest.writeString(wechatId);
        dest.writeInt(avatarResId);
        dest.writeString(remark);
    }
} 